﻿@model PotentialRentals.Models.Rental

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Ajax.BeginForm("ConfirmAddress", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "create-rental-content" }))
{
    @Html.ValidationSummary(true)
        
    <div class="editor-label">
        @Html.LabelFor(model => model.Address.Name)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Address.Name)
        @Html.ValidationMessageFor(model => model.Address.Name)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Address.Street)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Address.Street)
        @Html.ValidationMessageFor(model => model.Address.Street)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Address.City)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Address.City)
        @Html.ValidationMessageFor(model => model.Address.City)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Address.State)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.Address.State.StateId, ViewBag.States as SelectList)<br />
        @Html.ValidationMessageFor(model => model.Address.State)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Phone)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Phone)
        @Html.ValidationMessageFor(model => model.Phone)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Email)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Email)
        @Html.ValidationMessageFor(model => model.Email)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Rent)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Rent, new { style = "width: 50px" })<br />
        @Html.ValidationMessageFor(model => model.Rent)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Deposit)
    </div>
    <div class="editor-field">
        @Html.TextBoxFor(model => model.Deposit, new { style = "width: 50px" })<br />
        @Html.ValidationMessageFor(model => model.Deposit)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Bedrooms)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.Bedrooms, ViewBag.Bedrooms as SelectList, new { style = "width: 45px" })<br />
        @Html.ValidationMessageFor(model => model.Bedrooms)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Bathrooms)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.Bathrooms, ViewBag.Bathrooms as SelectList, new { style = "width: 45px" })<br />
        @Html.ValidationMessageFor(model => model.Bathrooms)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Type)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.Type.RentTypeId, ViewBag.RentalTypes as SelectList, new { style = "width: 95px" })<br />
        @Html.ValidationMessageFor(model => model.Type)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Amenities)
    </div>
    <div class="editor-field">
        @foreach (var amenity in ViewBag.RentalAmenityList as MultiSelectList)
        {
            <input type="checkbox" name="RentalAmenityList" value="@amenity.Value" /> @amenity.Text<br />
        }
    </div>
    
    <p>
        <input type="submit" value="Create" />
    </p>
}